﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmartMathLibrary.Management
{
    /// <summary>
    /// This class describes a field of a class. It contains its name, value and type.
    /// </summary>
    [Serializable]
    public class Field
    {
        /// <summary>
        /// The name of the field.
        /// </summary>
        private readonly String name;

        /// <summary>
        /// The type of the field.
        /// </summary>
        private readonly Type type;

        /// <summary>
        /// The value of the field.
        /// </summary>
        private readonly Object value;

        /// <summary>
        /// Initializes a new instance of the <see cref="Field"/> class.
        /// </summary>
        /// <param name="name">The name of the field.</param>
        /// <param name="value">The value of the field.</param>
        /// <param name="type">The type of the field.</param>
        public Field(String name, Object value, Type type)
        {
            this.name = name;
            this.type = type;
            this.value = value;
        }

        /// <summary>
        /// Gets the type of the field.
        /// </summary>
        /// <value>The type of the field.</value>
        public Type Type
        {
            get { return type; }
        }

        /// <summary>
        /// Gets the name of the field.
        /// </summary>
        /// <value>The name of the field.</value>
        public String Name
        {
            get { return name; }
        }

        /// <summary>
        /// Gets the value of the field.
        /// </summary>
        /// <value>The value of the field.</value>
        public Object Value
        {
            get { return this.value; }
        }
    }
}